#!/usr/bin/env python  
#-*- coding:utf-8 _*-  
""" 
@author:hello_life 
@license: Apache Licence 
@file: parameters.py 
@time: 2022/04/04
@software: PyCharm 
description:用于机器学习的参数设置
"""
import os
import argparse

import datetime
import pickle

import torch

os.environ["CUDA_VISIBLE_DEVICES"]="0"

class Config():
    def __init__(self):
        #train 参数
        self.batch_size=32
        self.epochs=2
        self.max_length=500    #文本长度
        self.device = "cuda" if torch.cuda.is_available() else "cpu"

        #model参数
        self.lr=0.001

        #文件路劲参数
        self.dir_path=os.path.abspath(os.getcwd())
        self.data_path=os.path.join(self.dir_path,"Data","IMDB Dataset.csv")    #数据集路劲
        self.vocab_path=os.path.join(self.dir_path,"Data","vocab1.pkl")    #词表路劲


        if os.path.exists(self.vocab_path):
            with open(self.vocab_path,"rb") as f:
                self.vocab=pickle.load(f)
            self.vocab_size = len(self.vocab)

        time1=datetime.datetime.now().strftime('%Y-%m-%d')
        time2 = datetime.datetime.now().strftime('%H-%M-%S')

        self.save_dir=os.path.join(self.dir_path,
                            "save_model",time1)  #存储文件夹路径
        self.save_path = os.path.join(self.save_dir, time2) #存储文件路劲

        self.pretrain_dir=os.path.join(self.dir_path,
                                  "Data","sgns.literature.word")  #下载词向量路劲

        self.pretrain_save_dir=os.path.join(self.dir_path,
                                  "Data","sgns_embedding")  #存储词向量路劲



if __name__ == '__main__':
    config=Config()
    print(config.save_path)
